Skip to content

Conversation

@andygrove
Copy link
Member

@andygrove andygrove commented Sep 30, 2025

Which issue does this PR close?

N/A

Rationale for this change

In the plan stability suite, there is a check that the expected and actual simplified and explain plans match, but only the simplified plan gets logged. This means that when the actual vs expected explain plan is different, no information is logged to show the difference. I discovered this while working on #2492

I split these changes out into a separate PR from #2492 to make reviews easier.

What changes are included in this PR?

How are these changes tested?

@codecov-commenter
Copy link

codecov-commenter commented Sep 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.40%. Comparing base (f09f8af) to head (6b121db).
⚠️ Report is 562 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2505      +/-   ##
============================================
+ Coverage     56.12%   58.40%   +2.28%     
- Complexity      976     1436     +460     
============================================
  Files           119      146      +27     
  Lines         11743    13510    +1767     
  Branches       2251     2350      +99     
============================================
+ Hits           6591     7891    +1300     
- Misses         4012     4389     +377     
- Partials       1140     1230      +90     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@andygrove andygrove marked this pull request as draft September 30, 2025 17:23
@andygrove andygrove changed the title chore: Improve test assertions in plan stability suite chore: Improve test assertions in plan stability suite [WIP] Sep 30, 2025
@andygrove andygrove marked this pull request as ready for review September 30, 2025 17:34
@andygrove andygrove changed the title chore: Improve test assertions in plan stability suite [WIP] chore: Improve test assertions in plan stability suite Sep 30, 2025
val message =
s"Expected $planType plan in ${expectedFile.getAbsolutePath} did not match " +
s"actual $planType plan in ${actualFile.getAbsolutePath}"
throw new ComparisonFailure(message, expected, actual)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One problem with ComparisonFailure may be that it logs everything in a single string. Perhaps if the expected and actual had some newlines at the beginning and at the end, then the output might be slightly easier to read?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I reverted to the previous approach of calling fail with the formatted plans


if (regenerateGoldenFiles) {
generateGoldenFile(plan, query + suffix, explain)
generateGoldenFile(dir, simplified, explain)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generateGoldenFile doesn't refer to name? prev implementaton referred to query + suffix

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name (query + suffix) was previously used in generateGoldenFile to create the dir but now we just pass that in, since it has already been computed.

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @andygrove

@andygrove andygrove merged commit 07393c1 into apache:main Oct 2, 2025
104 checks passed
@andygrove andygrove deleted the improve-plan-stability-test branch October 2, 2025 00:26
coderfender pushed a commit to coderfender/datafusion-comet that referenced this pull request Dec 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants